package com.mineplatform.dto;

import com.mineplatform.dto.rep.AppInfoRep;
import com.mineplatform.util.STATUSCODE;
import com.mineplatform.util.STATUSMSG;

public class BaseRep<D> {

	public Boolean getSuccess() {
		return success;
	}

	public void setSuccess(Boolean success) {
		this.success = success;
	}

	public D getData() {
		return data;
	}

	public void setData(D data) {
		this.data = data;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	private Boolean success;
	private D data;
	private String code;
	private String msg;

	public BaseRep() {

	}

	public BaseRep(Boolean _success, String _code, String _msg, D _data) {
		this.success = _success;
		this.code = _code;
		this.msg = _msg;
		this.data = _data;
	}

	public static <T> BaseRep<T> CreateExceptionResult(Exception ex) {

		// LOG ERROR HERE
		return new BaseRep<T>(false, STATUSCODE.SERVERERROR, ex.toString(), null);
	}

	public static <T> BaseRep<T> CreateJsonParseExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.REQJSONERROR, STATUSMSG.REQJSONERROR, null);
	}

	public static <T> BaseRep<T> CreateAppInfoNotExistExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.APPINFONOTEXIST, STATUSMSG.APPINFONOTEXIST, null);
	}

	public static <T> BaseRep<T> CreateClientNotRegExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.CLIENTNOTREG, STATUSMSG.CLIENTNOTREG, null);
	}

	public static <T> BaseRep<T> CreateAuthErrorExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.SIGNERROR, STATUSMSG.SIGNERROR, null);
	}

	public static <T> BaseRep<T> CreateUserNameNullOrEmptyExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.USERNAMENULLOREMPTY, STATUSMSG.USERNAMENULLOREMPTY, null);
	}

	public static <T> BaseRep<T> CreateUserNameFormatInvalidExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.USERNAMEFORMATINVALID, STATUSMSG.USERNAMEFORMATINVALID, null);
	}

	public static <T> BaseRep<T> CreateUserPasswordNullOrEmptyExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.USERPASSWORDNULLOREMPTY, STATUSMSG.USERPASSWORDNULLOREMPTY, null);
	}

	public static <T> BaseRep<T> CreateUserExistExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.USEREXIST, STATUSMSG.USEREXIST, null);
	}

	public static <T> BaseRep<T> CreateTokenNullOrEmptyExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.TOKENNULLOREMPTY, STATUSMSG.TOKENNULLOREMPTY, null);
	}

	public static <T> BaseRep<T> CreateTokenNotExistExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.TOKENMODELNOTEXIST, STATUSMSG.TOKENMODELNOTEXIST, null);
	}

	public static <T> BaseRep<T> CreateTokenDisableExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.TOKENDISABLE, STATUSMSG.TOKENDISABLE, null);
	}

	public static <T> BaseRep<T> CreateGenderInvalidExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.GENDERINVALID, STATUSMSG.GENDERINVALID, null);
	}

	public static <T> BaseRep<T> CreateEducationInvalidExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.EDUCATIONINVALID, STATUSMSG.EDUCATIONINVALID, null);
	}

	public static <T> BaseRep<T> CreateAgeInvalidExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.AGEINVALID, STATUSMSG.AGEINVALID, null);
	}

	public static <T> BaseRep<T> CreateUserNotExistExceptionResult() {

		return new BaseRep<T>(false, STATUSCODE.USERNOTEXIST, STATUSMSG.USERNOTEXIST, null);
	}

	public static <T> BaseRep<T> CreateUserPasswordErrorExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.USERPASSWORDERROR, STATUSMSG.USERPASSWORDERROR, null);
	}

	public static <T> BaseRep<T> CreateFileSaveErrorExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.FILESAVEERROR, STATUSMSG.FILESAVEERROR, null);
	}

	public static <T> BaseRep<T> CreateFileTypeInvalidExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.FIlETYPEINVALID, STATUSMSG.FIlETYPEINVALID, null);
	}

	public static <T> BaseRep<T> CreateFileNameInvalidExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.FIlENAMEINVALID, STATUSMSG.FIlENAMEINVALID, null);
	}

	public static <T> BaseRep<T> CreateFileNameNullOrEmptyExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.FIlENAMENULLOREMPTY, STATUSMSG.FIlENAMENULLOREMPTY, null);
	}

	public static <T> BaseRep<T> CreateAvatarNullExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.AVATARNULL, STATUSMSG.AVATARNULL, null);
	}

	public static <T> BaseRep<T> CreateAvatarSizeTooLargeExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.AVATARSIZETOOLARGE, STATUSMSG.AVATARSIZETOOLARGE, null);
	}

	public static <T> BaseRep<T> CreateMineIdNullOrEmptyExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.MINEIDNULL, STATUSMSG.MINEIDNULL, null);
	}

	public static <T> BaseRep<T> CreateReplyContentNullOrEmptyExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.REPLYCONTENTNULLOREMPTY, STATUSMSG.REPLYCONTENTNULLOREMPTY, null);
	}

	public static <T> BaseRep<T> CreateMineNotExistExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.MINENOTEXIST, STATUSMSG.MINENOTEXIST, null);
	}

	public static <T> BaseRep<T> CreateUserIdNullOrEmptyExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.USERIDNULLOREMPTY, STATUSMSG.USERIDNULLOREMPTY, null);
	}

	public static <T> BaseRep<T> CreateTelNullOrEmptyExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.TELNULLOREMPTY, STATUSMSG.TELNULLOREMPTY, null);
	}

	public static <T> BaseRep<T> CreateTelNumFormatInvalidExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.TELNUMFORMATINVALID, STATUSMSG.TELNUMFORMATINVALID, null);
	}

	public static <T> BaseRep<T> CreateAdminCannotRegistExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.ADMINCANNOTREGIST, STATUSMSG.ADMINCANNOTREGIST, null);
	}

	public static <T> BaseRep<T> CreateFromUserNotExistExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.FROMUSRNOTEXIST, STATUSMSG.FROMUSRNOTEXIST, null);
	}

	public static <T> BaseRep<T> CreateToUserNotExistExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.TOUSRNOTEXIST, STATUSMSG.TOUSRNOTEXIST, null);
	}

	public static <T> BaseRep<T> CreatePriceNullOrEmptyExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.PRICENULLOREMPTY, STATUSMSG.PRICENULLOREMPTY, null);
	}

	public static <T> BaseRep<T> CreateFeedbackNullOrEmptyExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.FEEDBACKNULLOREMPTY, STATUSMSG.FEEDBACKNULLOREMPTY, null);
	}

	public static <T> BaseRep<T> CreatePermissionDeniedExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.PERMISSIONDENIED, STATUSMSG.PERMISSIONDENIED, null);
	}

	public static <T> BaseRep<T> CreateRecordNotExistExceptionResult() {
		return new BaseRep<T>(false, STATUSCODE.RECORDNOTEXIST, STATUSMSG.RECORDNOTEXIST, null);
	}

}
